package com.iot08.common.utils;

import java.util.regex.Pattern;

/**
 * @version 1.0
 * @Description: 字符串校验相关工具类
 * @author: Rock
 * @time: 2020/8/27 11:06
 */
public class RegexUtil {

    /**
     * 校验设备id（IMEI）
     *
     * @param [value]
     * @time: 2020/9/2 10:03
     * @author: Rock
     * @version 1.0
     */
    public static boolean validateDeviceId(String value) {
        Pattern pattern = Pattern.compile("^[A-Za-z0-9]{14,15}$");
        return pattern.matcher(value).matches();
    }

    /**
     * 校验APP用户的密码
     *
     * @param [value]
     * @time: 2020/9/2 10:04
     * @author: Rock
     * @version 1.0
     */
    public static boolean validateAccountPwd(String value) {
        Pattern pattern = Pattern.compile("^[A-Za-z0-9]{6,16}$");
        return pattern.matcher(value).matches();
    }

}
